package adc.app.ui.wicket;

import org.apache.wicket.Component;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.border.Border;
import org.apache.wicket.model.IModel;

public class TitleBorder extends Border {

	private static final long serialVersionUID = 1L;
	
	private Component title;
	
	public TitleBorder(String id, IModel<?> title) {
		this(id, null, title);
	}
	
	public TitleBorder(String id, IModel<?> model, IModel<?> title) {
		super(id, model);
		add(this.title = createTitle("title", title));
	}

	public final IModel<?> getTitle() {
		return title.getDefaultModel();
	}

	public final TitleBorder setTitle(IModel<?> title) {
		this.title.setDefaultModel(title);
		return this;
	}
	
	protected Component createTitle(String titleId, IModel<?> title) {
		return new Label(titleId, title);
	}

}
